package com.samsung.service.impl.user;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.samsung.dao.user.UserMapper;
import com.samsung.model.user.User;
import com.samsung.service.user.UserService;

@Service("userService")
public class UserServiceImpl implements UserService{

	@Autowired
	private UserMapper userMapper;
	
	@Override
	public int update(User user) {
		return userMapper.updateByPrimaryKeySelective(user);
	}
	
	@Override
	public int regist(User user) {
		return userMapper.insert(user);
	}

	/*从数据库中取出用户信息*/
	@Override
	public List<User> getAllUser() {
		return userMapper.getAllUserInfo();
	}
	/*逻辑删除用户信息*/
	@Override
	public int delete(String uid) {
		return userMapper.deleteByUid(uid);
	}

	
	/*对用户表的分页查询*/
	@Override
	public List<User> getPageUser(int startIndex) {
		return userMapper.getPageUser(startIndex);
	}

	@Override
	public List<User> getAllUserId() {
		return userMapper.getAllUserId();
	}

	@Override
	public User selectByPrimaryKey(String uid) {
		return userMapper.selectByPrimaryKey(uid);
	}
	
	public int updateUser(User user) {
		return userMapper.updateByPrimaryKeySelective(user);
	}
	
	
}